/* 
 *  <copyright file="Base2DGraphic.cs" company="Wesley Jowitt">
 *  
 *  SobrietyEngine: Copyright (c) 2011 Wesley Jowitt
 *  
 *  This software is distributed under a software license.
 *   * As of the creation time of this file, the license in use is the Microsoft Permissive License (Ms-PL) 
 *    * The license can be viewed at:
 *     * License.Txt in the root folder of this project
 *      * http://sobrietyengine.codeplex.com/license
 *       * http://www.microsoft.com/opensource/licenses.mspx
 *       
 *  </copyright>
 *   */

using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace SobrietyEngine.Components.Graphic
{
    public abstract class Base2DGraphic : BaseComponent, IComponent, IGraphicVisibility
    {
        protected Boolean flipImageHorz = false;
        public Boolean FlipImageHorz { get { return flipImageHorz; } set { flipImageHorz = value; } }

        protected Boolean flipImageVert = false;
        public Boolean FlipImageVert { get { return flipImageVert; } set { flipImageVert = value; } }

        protected float layer = 1.0f;
        public float Layer { get { return layer; } set { layer = value; } }

        private Color color = Color.White;
        public Color Color
        {
            get { return color; }
            set { color = value; }
        }

        public Boolean Visible { get; set; }
        
        protected int boundingRadius = -1;
        public int BoundingRadius
        {
            get
            {
                if (boundingRadius < 0)
                    throw new Exception("Bounding radius not set");
                return boundingRadius;
            }
            private set { boundingRadius = value; }
        }

        protected Boolean alwaysDraw = false;
        public Boolean AlwaysDraw { get { return alwaysDraw; } set { alwaysDraw = value; } }

        public Base2DGraphic()
            : base()
        {
            Visible = true;
        }

        override public Type[] SupportedInterfaces()
        {
            return new Type[] { typeof(IGraphic2D) , typeof(IGraphicVisibility) };
        }

        abstract public void Draw(SpriteBatch spriteBatch);

        public abstract void UpdateGraphic(GameTime time);
        
    }
}